package com.fr.data.core.db.handler;

import com.fr.data.core.db.dialect.Dialect;
import com.fr.util.Utils;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class IntegerTypeHandler extends AbstractSQLTypeHandler
{
  public void setValue(PreparedStatement paramPreparedStatement, int paramInt1, Object paramObject, int paramInt2, Dialect paramDialect)
    throws SQLException
  {
    if (paramObject instanceof Integer)
      paramPreparedStatement.setInt(paramInt1, ((Integer)paramObject).intValue());
    else
      checkIsString(paramPreparedStatement, paramInt1, paramObject, paramInt2);
  }

  protected void parseString(PreparedStatement paramPreparedStatement, int paramInt, String paramString)
    throws Exception
  {
    paramPreparedStatement.setInt(paramInt, Utils.objectToNumber(paramString, false).intValue());
  }

  public Object getValue(ResultSet paramResultSet, int paramInt1, int paramInt2, Dialect paramDialect)
    throws SQLException
  {
    return getIntegerValue(paramResultSet, paramInt1);
  }
}